package com.itqf.Service.Service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itqf.Dao.ServiceMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class ServicerService implements com.itqf.Service.Service.ServicerService
{
 @Resource
 private ServiceMapper serviceMapper;

    /**
    * 用户提问题记录回显
    * */
    @Override
    public PageInfo FindLikeByserviceId(int pageindex, Integer pagesize, String  userid) {
        PageHelper.startPage(pageindex,pagesize);

        Map map=new HashMap();

        map.put("userid",userid);

        List<com.itqf.entity.Service> serviceList= serviceMapper.FindLikeByserviceId(map);

        PageInfo pageInfo=new PageInfo(serviceList);


        return pageInfo;
    }

    @Override
    public int InsertuserService(String userService,String Userid) {
        Map map=new HashMap();
        map.put("userService",userService);
        map.put("Userid",Userid);
        Date date=new Date();
        String format = new SimpleDateFormat("yyyy-MM-dd").format(date);
        map.put("userServicetime",format);
        return serviceMapper.insertSelectiveByyUserid(map);
    }
}
